import layoutHeaderAside from '@/layout/header-aside'
import emptyLayout from '@/layout/empty/layout'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

/**
 * 在主框架内显示
 */
const frameIn = [{
    path: '/',
    redirect: { name: 'index' },
    component: layoutHeaderAside,
    children: [{
        path: 'index',
        name: 'index',
        meta: {
            auth: true,
            title: '抖音账号管理'
        },
        component: _import('douyinPage/douyinAccount/douyinAccountList')
    },
    {
        path: 'douyinAccount',
        name: 'douyinAccount',
        meta: {
            auth: true,
            title: '抖音账号管理'
        },
        component: emptyLayout,
        children: [{
            path: 'douyinAccountList',
            name: 'douyinAccountList',
            meta: {
                auth: true,
                title: '抖音账号列表'
            },
            component: _import('douyinPage/douyinAccount/douyinAccountList')
        },
        {
            path: 'changeDouyinAccount',
            name: 'changeDouyinAccount',
            meta: {
                auth: true,
                title: '编辑抖音账号'
            },
            component: _import('douyinPage/douyinAccount/changeDouyinAccount')
        }
        ]
    },
    {
        path: 'douyinLink',
        name: 'douyinLink',
        meta: {
            auth: true,
            title: '抖音Link管理'
        },
        component: emptyLayout,
        children: [{
            path: 'douyinLinkList',
            name: 'douyinLinkList',
            meta: {
                auth: true,
                title: '抖音Link列表'
            },
            component: _import('douyinPage/douyinLink/douyinLinkList')
        },
        {
            path: 'changeDouyinLink',
            name: 'changeDouyinLink',
            meta: {
                auth: true,
                title: '编辑抖音Link'
            },
            component: _import('douyinPage/douyinLink/changeDouyinLink')
        }
        ]
    },
    {
        path: 'message',
        name: 'message',
        meta: {
            auth: true,
            title: '抖音消息管理'
        },
        component: emptyLayout,
        children: [{
            path: 'messageModelList',
            name: 'messageModelList',
            meta: {
                auth: true,
                title: '消息列表'
            },
            component: _import('douyinPage/message/messageModelList')
        },
        {
            path: 'changeMessageModel',
            name: 'changeMessageModel',
            meta: {
                auth: true,
                title: '编辑消息模版'
            },
            component: _import('douyinPage/message/changeMessageModel')
        }
        ]
    },
    {
        path: 'adminUser',
        name: 'adminUser',
        meta: {
            auth: true,
            title: '管理员管理'
        },
        component: emptyLayout,
        children: [{
            path: 'adminUserList',
            name: 'adminUserList',
            meta: {
                auth: true,
                title: '用户列表'
            },
            component: _import('weiboPage/adminUser/adminUserList')
        },
        {
            path: 'changeAdminUser',
            name: 'changeAdminUser',
            meta: {
                auth: true,
                title: '编辑用户'
            },
            component: _import('weiboPage/adminUser/changeAdminUser')
        }
        ]
    },
        // {
        //     path: 'point',
        //     name: 'point',
        //     meta: {
        //         auth: true,
        //         title: '积分管理'
        //     },
        //     component: emptyLayout,
        //     children: [{
        //         path: 'changePoint',
        //         name: 'changePoint',
        //         meta: {
        //             auth: true,
        //             title: '会员扫码积分'
        //         },
        //         component: _import('musePage/point/changePoint')
        //     }]
        // }
    ]
}]
/**
 * 在主框架之外显示
 */
const frameOut = [
    // 登录
    {
        path: '/login',
        name: 'login',
        component: _import('system/login')
    }
]

/**
 * 错误页面
 */
const errorPage = [{
    path: '*',
    name: '404',
    component: _import('system/error/404')
}]

// 导出需要显示菜单的
export const frameInRoutes = frameIn

// 重新组织后导出
export default [
    ...frameIn,
    ...frameOut,
    ...errorPage
]
